package com.yaojiaxun.logisticsPlatformSystem.mapper;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.yaojiaxun.logisticsPlatformSystem.entity.BuildInfo;
import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @Auther: yjx_j
 * @Date: 2019/1/23 10:59
 * @Description:
 */
@Mapper
public interface BuildInfoMapper extends BaseMapper<BuildInfo> {

    @Select("select * from build_info where build_id = #{buildId}")
    public BuildInfo selectBuildById(@Param("buildId") Long buildId);

    @Delete("delete from build_info where build_id = #{buildId}")
    public Integer deleteBuildInfoById(@RequestParam("buildId") Long buildId);

    @Update("update build_info set build_type=#{buildType}, build_name=#{buildName}, belong_com=#{belongCom}, belong_com_people=#{belongComPeople}, belong_com_phone=#{belongComPhone}, use_com=#{useCom}, area=#{area}, build_address=#{buildAddress}, build_time=#{buildTime} " +
            "where build_id=#{buildId}")
    public Integer updateBuildInfo(@RequestParam("buildInfo") BuildInfo buildInfo);

    @Insert("insert into build_info(build_id, build_type, build_name, belong_com, belong_com_people, belong_com_phone, use_com, area, build_address, build_time, create_time, update_time) values(#{buildInfo.buildId}, #{buildInfo.buildType}, " +
            "#{buildInfo.buildName}, #{buildInfo.belongCom}, #{buildInfo.belongComPeople}, #{buildInfo.belongComPhone}, #{buildInfo.useCom}, #{buildInfo.area}, #{buildInfo.buildAddress}, #{buildInfo.buildTime}, #{buildInfo.createTime}, #{buildInfo.updateTime})")
    public Integer addBuildInfo(@Param("buildInfo") BuildInfo buildInfo);
}
